<?php include_once "usuariosinfo.php" ?>
<?php

// Create page object
if (!isset($subrubro_grid)) $subrubro_grid = new csubrubro_grid();

// Page init
$subrubro_grid->Page_Init();

// Page main
$subrubro_grid->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$subrubro_grid->Page_Render();
?>
<?php if ($subrubro->Export == "") { ?>
<script type="text/javascript">

// Page object
var subrubro_grid = new ew_Page("subrubro_grid");
subrubro_grid.PageID = "grid"; // Page ID
var EW_PAGE_ID = subrubro_grid.PageID; // For backward compatibility

// Form object
var fsubrubrogrid = new ew_Form("fsubrubrogrid");
fsubrubrogrid.FormKeyCountName = '<?php echo $subrubro_grid->FormKeyCountName ?>';

// Validate form
fsubrubrogrid.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
		var checkrow = (gridinsert) ? !this.EmptyRow(infix) : true;
		if (checkrow) {
			addcnt++;

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
		} // End Grid Add checking
	}
	return true;
}

// Check empty row
fsubrubrogrid.EmptyRow = function(infix) {
	var fobj = this.Form;
	if (ew_ValueChanged(fobj, infix, "SubRubro", false)) return false;
	if (ew_ValueChanged(fobj, infix, "SubRubroNombre", false)) return false;
	if (ew_ValueChanged(fobj, infix, "SubRubroHabilitada[]", false)) return false;
	return true;
}

// Form_CustomValidate event
fsubrubrogrid.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fsubrubrogrid.ValidateRequired = true;
<?php } else { ?>
fsubrubrogrid.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
fsubrubrogrid.Lists["x_SubRubro"] = {"LinkField":"x_RubroId","Ajax":null,"AutoFill":false,"DisplayFields":["x_RubroNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};

// Form object for search
</script>
<?php } ?>
<?php if ($subrubro->getCurrentMasterTable() == "" && $subrubro_grid->ExportOptions->Visible()) { ?>
<div class="ewListExportOptions"><?php $subrubro_grid->ExportOptions->Render("body") ?></div>
<?php } ?>
<?php
if ($subrubro->CurrentAction == "gridadd") {
	if ($subrubro->CurrentMode == "copy") {
		$bSelectLimit = EW_SELECT_LIMIT;
		if ($bSelectLimit) {
			$subrubro_grid->TotalRecs = $subrubro->SelectRecordCount();
			$subrubro_grid->Recordset = $subrubro_grid->LoadRecordset($subrubro_grid->StartRec-1, $subrubro_grid->DisplayRecs);
		} else {
			if ($subrubro_grid->Recordset = $subrubro_grid->LoadRecordset())
				$subrubro_grid->TotalRecs = $subrubro_grid->Recordset->RecordCount();
		}
		$subrubro_grid->StartRec = 1;
		$subrubro_grid->DisplayRecs = $subrubro_grid->TotalRecs;
	} else {
		$subrubro->CurrentFilter = "0=1";
		$subrubro_grid->StartRec = 1;
		$subrubro_grid->DisplayRecs = $subrubro->GridAddRowCount;
	}
	$subrubro_grid->TotalRecs = $subrubro_grid->DisplayRecs;
	$subrubro_grid->StopRec = $subrubro_grid->DisplayRecs;
} else {
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$subrubro_grid->TotalRecs = $subrubro->SelectRecordCount();
	} else {
		if ($subrubro_grid->Recordset = $subrubro_grid->LoadRecordset())
			$subrubro_grid->TotalRecs = $subrubro_grid->Recordset->RecordCount();
	}
	$subrubro_grid->StartRec = 1;
	$subrubro_grid->DisplayRecs = $subrubro_grid->TotalRecs; // Display all records
	if ($bSelectLimit)
		$subrubro_grid->Recordset = $subrubro_grid->LoadRecordset($subrubro_grid->StartRec-1, $subrubro_grid->DisplayRecs);
}
$subrubro_grid->RenderOtherOptions();
?>
<?php $subrubro_grid->ShowPageHeader(); ?>
<?php
$subrubro_grid->ShowMessage();
?>
<table class="ewGrid"><tr><td class="ewGridContent">
<div id="fsubrubrogrid" class="ewForm form-inline">
<div id="gmp_subrubro" class="ewGridMiddlePanel">
<table id="tbl_subrubrogrid" class="ewTable ewTableSeparate">
<?php echo $subrubro->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$subrubro_grid->RenderListOptions();

// Render list options (header, left)
$subrubro_grid->ListOptions->Render("header", "left");
?>
<?php if ($subrubro->SubRubroId->Visible) { // SubRubroId ?>
	<?php if ($subrubro->SortUrl($subrubro->SubRubroId) == "") { ?>
		<td><div id="elh_subrubro_SubRubroId" class="subrubro_SubRubroId"><div class="ewTableHeaderCaption"><?php echo $subrubro->SubRubroId->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_subrubro_SubRubroId" class="subrubro_SubRubroId">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $subrubro->SubRubroId->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($subrubro->SubRubroId->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($subrubro->SubRubroId->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($subrubro->SubRubro->Visible) { // SubRubro ?>
	<?php if ($subrubro->SortUrl($subrubro->SubRubro) == "") { ?>
		<td><div id="elh_subrubro_SubRubro" class="subrubro_SubRubro"><div class="ewTableHeaderCaption"><?php echo $subrubro->SubRubro->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_subrubro_SubRubro" class="subrubro_SubRubro">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $subrubro->SubRubro->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($subrubro->SubRubro->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($subrubro->SubRubro->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($subrubro->SubRubroNombre->Visible) { // SubRubroNombre ?>
	<?php if ($subrubro->SortUrl($subrubro->SubRubroNombre) == "") { ?>
		<td><div id="elh_subrubro_SubRubroNombre" class="subrubro_SubRubroNombre"><div class="ewTableHeaderCaption"><?php echo $subrubro->SubRubroNombre->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_subrubro_SubRubroNombre" class="subrubro_SubRubroNombre">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $subrubro->SubRubroNombre->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($subrubro->SubRubroNombre->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($subrubro->SubRubroNombre->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($subrubro->SubRubroHabilitada->Visible) { // SubRubroHabilitada ?>
	<?php if ($subrubro->SortUrl($subrubro->SubRubroHabilitada) == "") { ?>
		<td><div id="elh_subrubro_SubRubroHabilitada" class="subrubro_SubRubroHabilitada"><div class="ewTableHeaderCaption"><?php echo $subrubro->SubRubroHabilitada->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_subrubro_SubRubroHabilitada" class="subrubro_SubRubroHabilitada">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $subrubro->SubRubroHabilitada->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($subrubro->SubRubroHabilitada->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($subrubro->SubRubroHabilitada->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php

// Render list options (header, right)
$subrubro_grid->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<tbody>
<?php
$subrubro_grid->StartRec = 1;
$subrubro_grid->StopRec = $subrubro_grid->TotalRecs; // Show all records

// Restore number of post back records
if ($objForm) {
	$objForm->Index = -1;
	if ($objForm->HasValue($subrubro_grid->FormKeyCountName) && ($subrubro->CurrentAction == "gridadd" || $subrubro->CurrentAction == "gridedit" || $subrubro->CurrentAction == "F")) {
		$subrubro_grid->KeyCount = $objForm->GetValue($subrubro_grid->FormKeyCountName);
		$subrubro_grid->StopRec = $subrubro_grid->StartRec + $subrubro_grid->KeyCount - 1;
	}
}
$subrubro_grid->RecCnt = $subrubro_grid->StartRec - 1;
if ($subrubro_grid->Recordset && !$subrubro_grid->Recordset->EOF) {
	$subrubro_grid->Recordset->MoveFirst();
	if (!$bSelectLimit && $subrubro_grid->StartRec > 1)
		$subrubro_grid->Recordset->Move($subrubro_grid->StartRec - 1);
} elseif (!$subrubro->AllowAddDeleteRow && $subrubro_grid->StopRec == 0) {
	$subrubro_grid->StopRec = $subrubro->GridAddRowCount;
}

// Initialize aggregate
$subrubro->RowType = EW_ROWTYPE_AGGREGATEINIT;
$subrubro->ResetAttrs();
$subrubro_grid->RenderRow();
if ($subrubro->CurrentAction == "gridadd")
	$subrubro_grid->RowIndex = 0;
if ($subrubro->CurrentAction == "gridedit")
	$subrubro_grid->RowIndex = 0;
while ($subrubro_grid->RecCnt < $subrubro_grid->StopRec) {
	$subrubro_grid->RecCnt++;
	if (intval($subrubro_grid->RecCnt) >= intval($subrubro_grid->StartRec)) {
		$subrubro_grid->RowCnt++;
		if ($subrubro->CurrentAction == "gridadd" || $subrubro->CurrentAction == "gridedit" || $subrubro->CurrentAction == "F") {
			$subrubro_grid->RowIndex++;
			$objForm->Index = $subrubro_grid->RowIndex;
			if ($objForm->HasValue($subrubro_grid->FormActionName))
				$subrubro_grid->RowAction = strval($objForm->GetValue($subrubro_grid->FormActionName));
			elseif ($subrubro->CurrentAction == "gridadd")
				$subrubro_grid->RowAction = "insert";
			else
				$subrubro_grid->RowAction = "";
		}

		// Set up key count
		$subrubro_grid->KeyCount = $subrubro_grid->RowIndex;

		// Init row class and style
		$subrubro->ResetAttrs();
		$subrubro->CssClass = "";
		if ($subrubro->CurrentAction == "gridadd") {
			if ($subrubro->CurrentMode == "copy") {
				$subrubro_grid->LoadRowValues($subrubro_grid->Recordset); // Load row values
				$subrubro_grid->SetRecordKey($subrubro_grid->RowOldKey, $subrubro_grid->Recordset); // Set old record key
			} else {
				$subrubro_grid->LoadDefaultValues(); // Load default values
				$subrubro_grid->RowOldKey = ""; // Clear old key value
			}
		} else {
			$subrubro_grid->LoadRowValues($subrubro_grid->Recordset); // Load row values
		}
		$subrubro->RowType = EW_ROWTYPE_VIEW; // Render view
		if ($subrubro->CurrentAction == "gridadd") // Grid add
			$subrubro->RowType = EW_ROWTYPE_ADD; // Render add
		if ($subrubro->CurrentAction == "gridadd" && $subrubro->EventCancelled && !$objForm->HasValue("k_blankrow")) // Insert failed
			$subrubro_grid->RestoreCurrentRowFormValues($subrubro_grid->RowIndex); // Restore form values
		if ($subrubro->CurrentAction == "gridedit") { // Grid edit
			if ($subrubro->EventCancelled) {
				$subrubro_grid->RestoreCurrentRowFormValues($subrubro_grid->RowIndex); // Restore form values
			}
			if ($subrubro_grid->RowAction == "insert")
				$subrubro->RowType = EW_ROWTYPE_ADD; // Render add
			else
				$subrubro->RowType = EW_ROWTYPE_EDIT; // Render edit
		}
		if ($subrubro->CurrentAction == "gridedit" && ($subrubro->RowType == EW_ROWTYPE_EDIT || $subrubro->RowType == EW_ROWTYPE_ADD) && $subrubro->EventCancelled) // Update failed
			$subrubro_grid->RestoreCurrentRowFormValues($subrubro_grid->RowIndex); // Restore form values
		if ($subrubro->RowType == EW_ROWTYPE_EDIT) // Edit row
			$subrubro_grid->EditRowCnt++;
		if ($subrubro->CurrentAction == "F") // Confirm row
			$subrubro_grid->RestoreCurrentRowFormValues($subrubro_grid->RowIndex); // Restore form values

		// Set up row id / data-rowindex
		$subrubro->RowAttrs = array_merge($subrubro->RowAttrs, array('data-rowindex'=>$subrubro_grid->RowCnt, 'id'=>'r' . $subrubro_grid->RowCnt . '_subrubro', 'data-rowtype'=>$subrubro->RowType));

		// Render row
		$subrubro_grid->RenderRow();

		// Render list options
		$subrubro_grid->RenderListOptions();

		// Skip delete row / empty row for confirm page
		if ($subrubro_grid->RowAction <> "delete" && $subrubro_grid->RowAction <> "insertdelete" && !($subrubro_grid->RowAction == "insert" && $subrubro->CurrentAction == "F" && $subrubro_grid->EmptyRow())) {
?>
	<tr<?php echo $subrubro->RowAttributes() ?>>
<?php

// Render list options (body, left)
$subrubro_grid->ListOptions->Render("body", "left", $subrubro_grid->RowCnt);
?>
	<?php if ($subrubro->SubRubroId->Visible) { // SubRubroId ?>
		<td<?php echo $subrubro->SubRubroId->CellAttributes() ?>>
<?php if ($subrubro->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<input type="hidden" data-field="x_SubRubroId" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" value="<?php echo ew_HtmlEncode($subrubro->SubRubroId->OldValue) ?>">
<?php } ?>
<?php if ($subrubro->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $subrubro_grid->RowCnt ?>_subrubro_SubRubroId" class="control-group subrubro_SubRubroId">
<span<?php echo $subrubro->SubRubroId->ViewAttributes() ?>>
<?php echo $subrubro->SubRubroId->EditValue ?></span>
</span>
<input type="hidden" data-field="x_SubRubroId" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" value="<?php echo ew_HtmlEncode($subrubro->SubRubroId->CurrentValue) ?>">
<?php } ?>
<?php if ($subrubro->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $subrubro->SubRubroId->ViewAttributes() ?>>
<?php echo $subrubro->SubRubroId->ListViewValue() ?></span>
<input type="hidden" data-field="x_SubRubroId" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" value="<?php echo ew_HtmlEncode($subrubro->SubRubroId->FormValue) ?>">
<input type="hidden" data-field="x_SubRubroId" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" value="<?php echo ew_HtmlEncode($subrubro->SubRubroId->OldValue) ?>">
<?php } ?>
<a id="<?php echo $subrubro_grid->PageObjName . "_row_" . $subrubro_grid->RowCnt ?>"></a></td>
	<?php } ?>
	<?php if ($subrubro->SubRubro->Visible) { // SubRubro ?>
		<td<?php echo $subrubro->SubRubro->CellAttributes() ?>>
<?php if ($subrubro->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<?php if ($subrubro->SubRubro->getSessionValue() <> "") { ?>
<span<?php echo $subrubro->SubRubro->ViewAttributes() ?>>
<?php echo $subrubro->SubRubro->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" value="<?php echo ew_HtmlEncode($subrubro->SubRubro->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_SubRubro" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro"<?php echo $subrubro->SubRubro->EditAttributes() ?>>
<?php
if (is_array($subrubro->SubRubro->EditValue)) {
	$arwrk = $subrubro->SubRubro->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($subrubro->SubRubro->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $subrubro->SubRubro->OldValue = "";
?>
</select>
<script type="text/javascript">
fsubrubrogrid.Lists["x_SubRubro"].Options = <?php echo (is_array($subrubro->SubRubro->EditValue)) ? ew_ArrayToJson($subrubro->SubRubro->EditValue, 1) : "[]" ?>;
</script>
<?php } ?>
<input type="hidden" data-field="x_SubRubro" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubro" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubro" value="<?php echo ew_HtmlEncode($subrubro->SubRubro->OldValue) ?>">
<?php } ?>
<?php if ($subrubro->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<?php if ($subrubro->SubRubro->getSessionValue() <> "") { ?>
<span<?php echo $subrubro->SubRubro->ViewAttributes() ?>>
<?php echo $subrubro->SubRubro->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" value="<?php echo ew_HtmlEncode($subrubro->SubRubro->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_SubRubro" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro"<?php echo $subrubro->SubRubro->EditAttributes() ?>>
<?php
if (is_array($subrubro->SubRubro->EditValue)) {
	$arwrk = $subrubro->SubRubro->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($subrubro->SubRubro->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $subrubro->SubRubro->OldValue = "";
?>
</select>
<script type="text/javascript">
fsubrubrogrid.Lists["x_SubRubro"].Options = <?php echo (is_array($subrubro->SubRubro->EditValue)) ? ew_ArrayToJson($subrubro->SubRubro->EditValue, 1) : "[]" ?>;
</script>
<?php } ?>
<?php } ?>
<?php if ($subrubro->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $subrubro->SubRubro->ViewAttributes() ?>>
<?php echo $subrubro->SubRubro->ListViewValue() ?></span>
<input type="hidden" data-field="x_SubRubro" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" value="<?php echo ew_HtmlEncode($subrubro->SubRubro->FormValue) ?>">
<input type="hidden" data-field="x_SubRubro" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubro" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubro" value="<?php echo ew_HtmlEncode($subrubro->SubRubro->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($subrubro->SubRubroNombre->Visible) { // SubRubroNombre ?>
		<td<?php echo $subrubro->SubRubroNombre->CellAttributes() ?>>
<?php if ($subrubro->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $subrubro_grid->RowCnt ?>_subrubro_SubRubroNombre" class="control-group subrubro_SubRubroNombre">
<input type="text" data-field="x_SubRubroNombre" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($subrubro->SubRubroNombre->PlaceHolder) ?>" value="<?php echo $subrubro->SubRubroNombre->EditValue ?>"<?php echo $subrubro->SubRubroNombre->EditAttributes() ?>>
</span>
<input type="hidden" data-field="x_SubRubroNombre" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" value="<?php echo ew_HtmlEncode($subrubro->SubRubroNombre->OldValue) ?>">
<?php } ?>
<?php if ($subrubro->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $subrubro_grid->RowCnt ?>_subrubro_SubRubroNombre" class="control-group subrubro_SubRubroNombre">
<input type="text" data-field="x_SubRubroNombre" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($subrubro->SubRubroNombre->PlaceHolder) ?>" value="<?php echo $subrubro->SubRubroNombre->EditValue ?>"<?php echo $subrubro->SubRubroNombre->EditAttributes() ?>>
</span>
<?php } ?>
<?php if ($subrubro->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $subrubro->SubRubroNombre->ViewAttributes() ?>>
<?php echo $subrubro->SubRubroNombre->ListViewValue() ?></span>
<input type="hidden" data-field="x_SubRubroNombre" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" value="<?php echo ew_HtmlEncode($subrubro->SubRubroNombre->FormValue) ?>">
<input type="hidden" data-field="x_SubRubroNombre" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" value="<?php echo ew_HtmlEncode($subrubro->SubRubroNombre->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($subrubro->SubRubroHabilitada->Visible) { // SubRubroHabilitada ?>
		<td<?php echo $subrubro->SubRubroHabilitada->CellAttributes() ?>>
<?php if ($subrubro->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $subrubro_grid->RowCnt ?>_subrubro_SubRubroHabilitada" class="control-group subrubro_SubRubroHabilitada">
<div id="tp_x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" value="{value}"<?php echo $subrubro->SubRubroHabilitada->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $subrubro->SubRubroHabilitada->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($subrubro->SubRubroHabilitada->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_SubRubroHabilitada" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $subrubro->SubRubroHabilitada->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $subrubro->SubRubroHabilitada->OldValue = "";
?>
</div>
</span>
<input type="hidden" data-field="x_SubRubroHabilitada" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" value="<?php echo ew_HtmlEncode($subrubro->SubRubroHabilitada->OldValue) ?>">
<?php } ?>
<?php if ($subrubro->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $subrubro_grid->RowCnt ?>_subrubro_SubRubroHabilitada" class="control-group subrubro_SubRubroHabilitada">
<div id="tp_x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" value="{value}"<?php echo $subrubro->SubRubroHabilitada->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $subrubro->SubRubroHabilitada->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($subrubro->SubRubroHabilitada->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_SubRubroHabilitada" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $subrubro->SubRubroHabilitada->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $subrubro->SubRubroHabilitada->OldValue = "";
?>
</div>
</span>
<?php } ?>
<?php if ($subrubro->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $subrubro->SubRubroHabilitada->ViewAttributes() ?>>
<?php echo $subrubro->SubRubroHabilitada->ListViewValue() ?></span>
<input type="hidden" data-field="x_SubRubroHabilitada" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" value="<?php echo ew_HtmlEncode($subrubro->SubRubroHabilitada->FormValue) ?>">
<input type="hidden" data-field="x_SubRubroHabilitada" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" value="<?php echo ew_HtmlEncode($subrubro->SubRubroHabilitada->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$subrubro_grid->ListOptions->Render("body", "right", $subrubro_grid->RowCnt);
?>
	</tr>
<?php if ($subrubro->RowType == EW_ROWTYPE_ADD || $subrubro->RowType == EW_ROWTYPE_EDIT) { ?>
<script type="text/javascript">
fsubrubrogrid.UpdateOpts(<?php echo $subrubro_grid->RowIndex ?>);
</script>
<?php } ?>
<?php
	}
	} // End delete row checking
	if ($subrubro->CurrentAction <> "gridadd" || $subrubro->CurrentMode == "copy")
		if (!$subrubro_grid->Recordset->EOF) $subrubro_grid->Recordset->MoveNext();
}
?>
<?php
	if ($subrubro->CurrentMode == "add" || $subrubro->CurrentMode == "copy" || $subrubro->CurrentMode == "edit") {
		$subrubro_grid->RowIndex = '$rowindex$';
		$subrubro_grid->LoadDefaultValues();

		// Set row properties
		$subrubro->ResetAttrs();
		$subrubro->RowAttrs = array_merge($subrubro->RowAttrs, array('data-rowindex'=>$subrubro_grid->RowIndex, 'id'=>'r0_subrubro', 'data-rowtype'=>EW_ROWTYPE_ADD));
		ew_AppendClass($subrubro->RowAttrs["class"], "ewTemplate");
		$subrubro->RowType = EW_ROWTYPE_ADD;

		// Render row
		$subrubro_grid->RenderRow();

		// Render list options
		$subrubro_grid->RenderListOptions();
		$subrubro_grid->StartRowCnt = 0;
?>
	<tr<?php echo $subrubro->RowAttributes() ?>>
<?php

// Render list options (body, left)
$subrubro_grid->ListOptions->Render("body", "left", $subrubro_grid->RowIndex);
?>
	<?php if ($subrubro->SubRubroId->Visible) { // SubRubroId ?>
		<td>
<?php if ($subrubro->CurrentAction <> "F") { ?>
<?php } else { ?>
<span id="el$rowindex$_subrubro_SubRubroId" class="control-group subrubro_SubRubroId">
<span<?php echo $subrubro->SubRubroId->ViewAttributes() ?>>
<?php echo $subrubro->SubRubroId->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_SubRubroId" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" value="<?php echo ew_HtmlEncode($subrubro->SubRubroId->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_SubRubroId" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroId" value="<?php echo ew_HtmlEncode($subrubro->SubRubroId->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($subrubro->SubRubro->Visible) { // SubRubro ?>
		<td>
<?php if ($subrubro->CurrentAction <> "F") { ?>
<?php if ($subrubro->SubRubro->getSessionValue() <> "") { ?>
<span<?php echo $subrubro->SubRubro->ViewAttributes() ?>>
<?php echo $subrubro->SubRubro->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" value="<?php echo ew_HtmlEncode($subrubro->SubRubro->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_SubRubro" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro"<?php echo $subrubro->SubRubro->EditAttributes() ?>>
<?php
if (is_array($subrubro->SubRubro->EditValue)) {
	$arwrk = $subrubro->SubRubro->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($subrubro->SubRubro->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $subrubro->SubRubro->OldValue = "";
?>
</select>
<script type="text/javascript">
fsubrubrogrid.Lists["x_SubRubro"].Options = <?php echo (is_array($subrubro->SubRubro->EditValue)) ? ew_ArrayToJson($subrubro->SubRubro->EditValue, 1) : "[]" ?>;
</script>
<?php } ?>
<?php } else { ?>
<span<?php echo $subrubro->SubRubro->ViewAttributes() ?>>
<?php echo $subrubro->SubRubro->ViewValue ?></span>
<input type="hidden" data-field="x_SubRubro" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubro" value="<?php echo ew_HtmlEncode($subrubro->SubRubro->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_SubRubro" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubro" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubro" value="<?php echo ew_HtmlEncode($subrubro->SubRubro->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($subrubro->SubRubroNombre->Visible) { // SubRubroNombre ?>
		<td>
<?php if ($subrubro->CurrentAction <> "F") { ?>
<span id="el$rowindex$_subrubro_SubRubroNombre" class="control-group subrubro_SubRubroNombre">
<input type="text" data-field="x_SubRubroNombre" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($subrubro->SubRubroNombre->PlaceHolder) ?>" value="<?php echo $subrubro->SubRubroNombre->EditValue ?>"<?php echo $subrubro->SubRubroNombre->EditAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_subrubro_SubRubroNombre" class="control-group subrubro_SubRubroNombre">
<span<?php echo $subrubro->SubRubroNombre->ViewAttributes() ?>>
<?php echo $subrubro->SubRubroNombre->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_SubRubroNombre" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" value="<?php echo ew_HtmlEncode($subrubro->SubRubroNombre->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_SubRubroNombre" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroNombre" value="<?php echo ew_HtmlEncode($subrubro->SubRubroNombre->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($subrubro->SubRubroHabilitada->Visible) { // SubRubroHabilitada ?>
		<td>
<?php if ($subrubro->CurrentAction <> "F") { ?>
<span id="el$rowindex$_subrubro_SubRubroHabilitada" class="control-group subrubro_SubRubroHabilitada">
<div id="tp_x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" value="{value}"<?php echo $subrubro->SubRubroHabilitada->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $subrubro->SubRubroHabilitada->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($subrubro->SubRubroHabilitada->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_SubRubroHabilitada" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $subrubro->SubRubroHabilitada->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $subrubro->SubRubroHabilitada->OldValue = "";
?>
</div>
</span>
<?php } else { ?>
<span id="el$rowindex$_subrubro_SubRubroHabilitada" class="control-group subrubro_SubRubroHabilitada">
<span<?php echo $subrubro->SubRubroHabilitada->ViewAttributes() ?>>
<?php echo $subrubro->SubRubroHabilitada->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_SubRubroHabilitada" name="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" id="x<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada" value="<?php echo ew_HtmlEncode($subrubro->SubRubroHabilitada->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_SubRubroHabilitada" name="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" id="o<?php echo $subrubro_grid->RowIndex ?>_SubRubroHabilitada[]" value="<?php echo ew_HtmlEncode($subrubro->SubRubroHabilitada->OldValue) ?>">
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$subrubro_grid->ListOptions->Render("body", "right", $subrubro_grid->RowCnt);
?>
<script type="text/javascript">
fsubrubrogrid.UpdateOpts(<?php echo $subrubro_grid->RowIndex ?>);
</script>
	</tr>
<?php
}
?>
</tbody>
</table>
<?php if ($subrubro->CurrentMode == "add" || $subrubro->CurrentMode == "copy") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridinsert">
<input type="hidden" name="<?php echo $subrubro_grid->FormKeyCountName ?>" id="<?php echo $subrubro_grid->FormKeyCountName ?>" value="<?php echo $subrubro_grid->KeyCount ?>">
<?php echo $subrubro_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($subrubro->CurrentMode == "edit") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridupdate">
<input type="hidden" name="<?php echo $subrubro_grid->FormKeyCountName ?>" id="<?php echo $subrubro_grid->FormKeyCountName ?>" value="<?php echo $subrubro_grid->KeyCount ?>">
<?php echo $subrubro_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($subrubro->CurrentMode == "") { ?>
<input type="hidden" name="a_list" id="a_list" value="">
<?php } ?>
<input type="hidden" name="detailpage" value="fsubrubrogrid">
</div>
<?php

// Close recordset
if ($subrubro_grid->Recordset)
	$subrubro_grid->Recordset->Close();
?>
<?php if ($subrubro_grid->ShowOtherOptions) { ?>
<div class="ewGridLowerPanel ewListOtherOptions">
<?php
	foreach ($subrubro_grid->OtherOptions as &$option)
		$option->Render("body", "bottom");
?>
</div>
<?php } ?>
</div>
</td></tr></table>
<?php if ($subrubro->Export == "") { ?>
<script type="text/javascript">
fsubrubrogrid.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php } ?>
<?php
$subrubro_grid->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<?php
$subrubro_grid->Page_Terminate();
?>
